<% layout('/layouts/default.html', {title: '文件分发管理', libs: ['dataGrid']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-notebook"></i> ${text('已还文列表')}

            </div>
            <div class="box-tools pull-left" style="margin-left: 50px;">
                <a href="#" style="color:red" class="btn btn-default"  onclick="selectUnit(3)"  id="song" title="${text('送文单位')}"><i class=" "></i> ${text('送文')}</a>
                <a href="#" class="btn btn-default"  onclick="selectUnit(2)" id="ling" title="${text('领文单位')}"><i class=" "></i> ${text('领文')}</a>
            </div>
            <div class="box-tools pull-right">
                <a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
            </div>
        </div>
        <div class="box-body">
            <#form:form id="searchForm" model="${docDeliverRecord}" action="${ctx}/sd/docDeliverAlreadyReturn/listData" method="post" class="form-inline hide"
            data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
            <div class="form-group">
                <label class="control-label">${text('来文自编号')}：</label>
                <div class="control-inline">
                    <#form:input path="docRecv.docSysCode"  maxlength="64" class="form-control width-120"/>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">${text('文件标题')}：</label>
                <div class="control-inline">
                    <#form:input path="docRecv.docTitle"  maxlength="64" class="form-control width-120"/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('紧急程度')}：</label>
                <div class="control-inline" style="width: 80px">
                    <#form:select path="docRecv.docEmergLvl"  dictType="recv_doc_emerg_lvl" blankOption="true" class="form-control"/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('密级')}：</label>
                <div class="control-inline width-120">
                    <#form:select path="docRecv.secLvl" dictType="recv_sec_lvl" blankOption="true" class="form-control"/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('领文人警号')}：</label>
                <div class="control-inline">
                    <#form:input path="takeUserPoliceno" maxlength="64" class="form-control width-120"/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('还文人警号')}：</label>
                <div class="control-inline">
                    <#form:input path="returnUserPoliceno" maxlength="64" class="form-control width-120"/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('领文单位')}：</label>

                <div class="control-inline width-120">
                    <#form:treeselect id="unit" title="领文单位选择" path="recvUnitCode"
                    url="${ctx}/sd/docDeliverRecord/treeData" class="" allowClear="true" />
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">${text('单位类型')}：</label>

                <div class="control-inline width-120">
                    <#form:select path="deliverType" id="lx" dictType="sd_deliver_send_take" blankOption="true" class="form-control"/>
                </div>
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
                <button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
            </div>
        </#form:form>
        <table id="dataGrid"></table>
        <div id="dataGridPage"></div>
    </div>
</div>
</div>
<% } %>
<script>
    function selectUnit(data){
        $("#lx").val(data).trigger('change');
        page();
        if (data==2){
           /* document.getElementById("ling").style.backgroundColor = "#1951be"
            document.getElementById("song").style.backgroundColor = "deepskyblue"*/
        }else{
          /*  document.getElementById("song").style.backgroundColor = "#1951be"
            document.getElementById("ling").style.backgroundColor = "deepskyblue"*/
        }
    }

</script>
<script>
    // 初始化DataGrid对象
    $('#dataGrid').dataGrid({
        searchForm: $("#searchForm"),
        columnModel: [
            {header:'${text("来文自编号")}', name:'docRecv.docSysCode', index:'c.doc_sys_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
                    return '<a href="${ctx}/sd/docDeliverAlreadyReturn/form?id='+row.id+'" class="btnList" data-title="${text("编辑文件分发")}">'+(val||row.id)+'</a>';
                }},
            {header:'${text("文件文号")}', name:'docRecv.docFullNum', index:'c.doc_full_num', width:150, align:"center"},
            {header:'${text("文件分发编号")}', name:'docCopyNo', index:'doc_copy_no', width:150, align:"center"},
            {header:'${text("文件标题")}', name:'docRecv.docTitle', index:'c.doc_title', width:150, align:"center"},
            {header:'${text("紧急程度")}', name:'docRecv.docEmergLvl', index:'c.doc_emerg_lvl', width:150, align:"center", formatter: function(val, obj, row, act){
                    return js.getDictLabel(${@DictUtils.getDictListJson('recv_doc_emerg_lvl')}, val, '${text("未知")}', true);
                }},
            {header:'${text("文件密级")}', name:'docRecv.secLvl', index:'c.sec_lvl', width:80, align:"center", formatter: function(val, obj, row, act){
                    return js.getDictLabel(${@DictUtils.getDictListJson('recv_sec_lvl')}, val, '${text("未知")}', true);
                }},
            {header:'${text("领文单位")}', name:'office.officeName', index:'o.office_name', width:150, align:"center"},
            {header:'${text("单位类型")}', name:'deliverType', index:'c.deliver_type', width:150, align:"center", formatter: function(val, obj, row, act){
                    return js.getDictLabel(${@DictUtils.getDictListJson('sd_deliver_send_take')}, val, '${text("未知")}', true);
                }},
            {header:'${text("领文时间")}', name:'takeDate', index:'take_date', width:150, align:"center"},
            {header:'${text("领文人姓名")}', name:'takeUserName', index:'take_user_name', width:150, align:"center"},

            {header:'${text("领文人警号")}', name:'takeUserPoliceno', index:'take_user_policeno', width:150, align:"center"},
            {header:'${text("还文时间")}', name:'returnDate', index:'return_date', width:150, align:"center"},
            {header:'${text("还文人姓名")}', name:'returnUserName', index:'return_user_name', width:150, align:"center"},

            {header:'${text("还文人警号")}', name:'returnUserPoliceno', index:'return_user_policeno', width:150, align:"center"},


            {header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
                    var actions = [];
                <% if(hasPermi('sd:docDeliverAlreadyReturn:edit')){ %>
                        actions.push('<a href="${ctx}/sd/docDeliverAlreadyReturn/form?id='+row.id+'" class="btnList" title="${text("查看")}"><i class="fa fa-search"></i></a>&nbsp;');

                    <% } %>
                    return actions.join('');
                }}
        ],
        // 加载成功后执行事件
        ajaxSuccess: function(data){

        }
    });
</script>